/**
 * the location of the Moon in architecture
 */
package Model;

/**
 *  Moon class that player can upgrade with their space booty
 * @author Ben
 * @version $Revision: 1.0 $
 */
public class Moon {
	
	/**
	 * the boolean array of the things on the moon
	 */
	private final boolean[] things = {false, 
			false, false, false, false, false, false, false};

	/**
	 * the names of the upgrades on the moon
	 */
	private final String[] upgradeStrings = 
		{"Pet Martian", "Castle", "Lava Pool", 
			"Comet Roller Coaster", "Free Dip N Dots", "E.T. Poster", 
			"Death Star Moon", "Swiss Cheese Moon"};

	/**
	 * the numerical value that describes the value of the moon
	 */
	private int moonVal;

	/**
	 * the output string of stuff on the moon
	 */
	private String moonStuff;

	/**
	 * to string method to print stuff on moon
	 * @return the string of moon stuff
	 */
	public String toString(){
		return moonStuff;
	}
	
	/**
	 * Moon constructor, initiates moonVal (coolness factor of moon) 
	 * to zero and sets MoonStuff
	 * to an empty string since the moon has not fun upgrades
	 */
	public Moon(){
		setMoonVal(0);
		moonStuff = "";
	}

	/**
	 * called when the player upgrades the moon. changes the boolean array to reflect 
	 * which upgrade in the String array has been selected. 
	 * MoonVal is incremented by one representing the amount of upgrades the moon has
	 * the upgrade the player has received is added to MoonStuff
	 * @param num the number the player has selected as the 
	 * upgrade they wish to purchase. 
	 * The upgrade will use this number to index the upgrade selected
	 */
	public void upgrade(int num){
		things[num - 1] = true;
		boolean var = true;
		setMoonVal(getMoonVal() + 1);
		int i = 0;
		while (i < 8){
			if (things[i] == var){
				moonStuff = moonStuff + upgradeStrings[i] + " ";
			}
			i++;
		}
		var = false;
	}

	/**
	 * @return the moonVal
	 */
	public int getMoonVal() {
		return moonVal;
	}

	/**
	 * @param moonVal the moonVal to set
	 */
	public void setMoonVal(int moonVal) {
		this.moonVal = moonVal;
	}
}
